﻿<Window x:Class="LuminaDesk.Core.Views.MenuWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
		xmlns:behaviors="clr-namespace:LuminaDesk.Core.Views.Behaviors"
		xmlns:models="clr-namespace:LuminaDesk.Core.Models"
		xmlns:properties="clr-namespace:LuminaDesk.Core.Properties"
		Width="200"
		ResizeMode="NoResize" SizeToContent="WidthAndHeight"
		ShowInTaskbar="False" Topmost="True"
		AllowsTransparency="True" WindowStyle="None"
		Background="{StaticResource App.Background.Plain}">
	<Window.InputBindings>
		<KeyBinding Command="ApplicationCommands.Close" Key="Esc"/>
	</Window.InputBindings>
	<Window.CommandBindings>
		<CommandBinding Command="ApplicationCommands.Close" Executed="OnDeactivated"/>
	</Window.CommandBindings>

	<StackPanel Margin="0,4">
		<TextBlock x:Name="AppTitle"
				   Margin="8,2"
				   Style="{StaticResource PlainTextStyle}"
				   Text="{Binding Source={x:Static models:ProductInfo.Title}, Mode=OneTime}"/>

		<StackPanel x:Name="HeadItems"
					Margin="0,0,0,6">
			<TextBlock Margin="8,0"
					   Style="{StaticResource PlainTextStyle}">
				<Run Text="{Binding Source={x:Static models:ProductInfo.Version}, Mode=OneTime}"/>
				<Run Text="|"/>
				<Run Foreground="{StaticResource App.Foreground.Shadow}"
					 TextDecorations="Underline" Cursor="Hand"
					 Text="{x:Static properties:Invariant.Site}">
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="MouseDown">
							<i:LaunchUriOrFileAction Path="{x:Static models:ProductInfo.ProjectUrl}"/>
						</i:EventTrigger>
					</i:Interaction.Triggers>
				</Run>
				<Run Text="|"/>
				<Run Foreground="{StaticResource App.Foreground.Shadow}"
					 TextDecorations="Underline" Cursor="Hand"
					 Text="{x:Static properties:Invariant.License}">
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="MouseDown">
							<i:CallMethodAction TargetObject="{Binding}"
												MethodName="OpenLicense"/>
						</i:EventTrigger>
					</i:Interaction.Triggers>
				</Run>
			</TextBlock>
		</StackPanel>

		<Separator Style="{StaticResource MenuSeparatorStyle}"/>

		<StackPanel x:Name="MenuItemsTop"/>

		<ContentControl Style="{StaticResource MenuItemStyle}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.StartSignIn}"
						  IsChecked="{Binding IsRegistered}"
						  Visibility="{Binding CanRegister, Mode=OneTime, Converter={StaticResource BooleanToVisibilityConverterKey}}"/>
		</ContentControl>

		<ContentControl Style="{StaticResource MenuItemStyle}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.UseLargeElements}"
						  IsChecked="{Binding Settings.UsesLargeElements}"/>
		</ContentControl>

		<ContentControl Style="{StaticResource MenuItemStyle}"
						Visibility="{Binding IsAccentColorSupported, Converter={StaticResource BooleanToVisibilityConverterKey}}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.UseAccentColor}"
						  IsChecked="{Binding Settings.UsesAccentColor}"/>
		</ContentControl>

		<ContentControl Style="{StaticResource MenuItemStyle}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.ShowAdjusted}"
						  IsChecked="{Binding Settings.ShowsAdjusted}"/>
		</ContentControl>

		<ContentControl Style="{StaticResource MenuItemStyle}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.OrderArrangement}"
						  IsChecked="{Binding Settings.OrdersArrangement}"/>
		</ContentControl>

		<ContentControl Style="{StaticResource MenuItemStyle}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.DeferChange}"
						  IsChecked="{Binding Settings.DefersChange}"/>
		</ContentControl>

		<StackPanel x:Name="MenuItemsMiddle"/>

		<Separator Style="{StaticResource MenuSeparatorStyle}"/>

		<ContentControl Style="{StaticResource MenuItemStyle}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.EnableUnison}"
						  IsChecked="{Binding Settings.EnablesUnison}"/>
		</ContentControl>

		<ContentControl Style="{StaticResource MenuItemStyle}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.EnableRange}"
						  IsChecked="{Binding Settings.EnablesRange}"/>
		</ContentControl>

		<ContentControl Style="{StaticResource MenuItemStyle}">
			<ToggleButton Padding="8,4"
						  Style="{StaticResource CheckButtonItemStyle}"
						  Content="{x:Static properties:Resources.EnableContrast}"
						  IsChecked="{Binding Settings.EnablesContrast}"/>
		</ContentControl>

		<Separator Style="{StaticResource MenuSeparatorStyle}"/>

		<!-- Close -->
		<ContentControl Style="{StaticResource MenuItemStyle}">
			<Button Padding="8,4"
					Style="{StaticResource CloseButtonItemStyle}"
					Content="{x:Static properties:Resources.Close}">
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="Click">
						<i:CallMethodAction TargetObject="{Binding}"
											MethodName="CloseApp"/>
					</i:EventTrigger>
				</i:Interaction.Triggers>
			</Button>
		</ContentControl>
	</StackPanel>

	<i:Interaction.Behaviors>
		<behaviors:FocusMenuBehavior/>
	</i:Interaction.Behaviors>
</Window>